1. Field of the Invention
The present invention relates to data processing. More particularly, the present invention relates to reducing memory usage of a data processing task being performed using a Virtual Machine associated with a data processing apparatus.
2. Description of the Prior Art
It is known to perform data processing tasks by executing platform-neutral program code on a Virtual Machine running on a data processing apparatus. The Virtual Machine provides an abstraction between the underlying computing hardware and the platform-neutral program code of the program application which is to be executed and thus provides greater portability of program code between different computer systems. It is also known to perform Dynamic Adaptive Compilation (DAC) of platform-neutral program code to platform-dependent program code, which enables compilation to be performed during the execution of program code and thus allows the compilation to take account of aspects of the virtual machine and underlying hardware and software. Known Dynamic Adaptive Compilers tend to interpret methods first, select the methods most worth compiling and perform compilation according to the current processing situation. Another known type of compilers used in processing systems having virtual machines are Just-in-Time (JIT) compilers. JIT compilers typically compile on a method-by-method basis just before a given method executes for the first time. Both DAC and JIT compilers can improve efficiency by avoiding individual bytecode by bytecode interpretation of the platform-neutral program code. Some such known compilers can unload compiled versions of program code (i.e. program code native to the host computer system), but always keeps the original bytecode version of the program instructions loaded in memory associated with the virtual machine. In the following description where reference is made to a “just-in-time” compiler, it should be assumed that a just-in-time compiler could have the properties of a JIT compiler, a DAC compiler as described above, or even both.
There is a trend towards production of ever smaller computing devices such as mobile phones and other handheld devices such as personal digital assistants. On such small devices data storage space is at a premium. The current lower bound for memory use of a program application at any point during execution of a data processing task is at least the storage capacity required to store all classes and associated methods or functions needed up to a current execution point. In the known Java Connected Limited Device Configuration (CLDC), classes cannot be unloaded from a Virtual Machine memory until the program application terminates. This is demanding on the limited memory resources of the host device. On the Java 2 Platform Standard Edition (J2SE), which is typically run on desktop computers, the Java 2 Platform Enterprise Edition (J2EE) version of the Virtual Machine (typically run on servers), and the Java 2 Micro Edition Connected Device Configuration (J2ME CDC), commonly used on small devices such as mobile phones, custom class loaders can be implemented and all classes loaded by the given class loader can be unloaded in their entirety. However, in these known Virtual Machines (J2SE, J2EE and J2ME CDC) unloading of a class is only possible if the class was loaded by a custom class loader and if no other program code needs to use the class loader any more. In the event that nothing uses the class loader any more then all classes associated with the class loader are unloaded together with the class loader itself.
It is also known to provide a paging system to manage memory of a data processing apparatus. In such computer systems, a processor referring to a page that hasn't been loaded into memory generates a page fault that is intercepted and handled by specialised hardware (i.e. a Memory Management Unit). Thus, in known paging systems, features built into a special-purpose hardware model (i.e. page faults, virtual addressing and page attributes) enable unloading of data from a memory of the computer system.
There is a requirement to reduce the memory usage of processing tasks being performed using a Virtual Machine (e.g. while the corresponding processing applications are idle or in background mode) in a way that does not require special-purpose hardware to perform unloading of data yet efficiently reduces the memory footprint of program applications.